<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>考勤方式设置</title>
    <link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <script type="text/javascript" src="../js/common/language.js" ></script>
    <script type="text/javascript" src="../js/news/jquery-1.9.1.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/news/page.js"></script>
    <script src="../lib/laydate/laydate.js"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/layer/layer.js?20201106"></script>
    <style>
        .buttonDiv>div{
            float: left;
            margin: 20px 10px;
        }
        .fileDone select{
            width: 160px;
            height:28px;
        }
        #tr_td tr:nth-child(odd){
            background-color: #fff;
        }
        input{
            float: none;
        }
        .newMange input[type="text"]{
            width: 260px;
            height: 30px;
        }
        select{
            width: 260px;
            height: 30px;
        }
        textarea{
            width: 420px;
            min-width: 220px;
            max-width: 420px;
            height: 150px;
            min-height: 80px;
            max-height: 150px;
            /*vertical-align: middle;*/
        }
        a{
            text-decoration: none;
            color: #207bd6;
        }
        .newTbale tr td{
            border-right: #ccc 1px solid;
            padding: 5px;
        }
        .main{
            width: 500px;
            height: 150px;
            /*border: #ccc 1px solid;*/
            margin: 0px auto;
            margin-top: 40px;
            margin-bottom: 20px;
        }
        .saveBtn{
            width: 50px;
            height: 30px;
            background: #2b7fe0;
            border-radius: 4px;
            cursor: pointer;
            text-align: center;
            color: #ffffff;
            line-height: 28px;
        }
        .wrap{
            width: 99%;
        }
        table{
            width: 50%;
            margin: 0 auto;
        }
        .return{
            width: 50px;
            height: 30px;
            background: #2b7fe0;
            border-radius: 4px;
            cursor: pointer;
            text-align: center;
            color: #ffffff;
            line-height: 28px;
            margin: 0px 20px;
        }
        .return a{
            color: #ffffff;

        }
    </style>
</head>

<body>
<div class="bx">

    <div class="navigation  clearfix juMange" id="noPer" style="display: block;">
        <div class="left" style="margin-left: 30px">
            <img src="/img/commonTheme/${sessionScope.InterfaceModel}/icon_manageFile.png">
            <div class="news">考勤方式设置</div>
        </div>
        <div style="clear: both;"></div>
        <div class="wrap" style="">
            <table border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;">
                <tr>
                    <td style="color: #2F5C8F;font-size: 13pt;font-weight: bold;">选择考勤方式</td>
                </tr>
                <tr>
                    <td>
                        <label>
                            <input type="radio" name="dutyMachine" value="1">
                            <span style="margin-right: 20px;">考勤机</span>
                        </label>
                        <label>
                            <input type="radio" name="dutyMachine" value="0">
                            <span style="margin-right: 20px;">手动考勤</span>
                        </label>
                        <%--<label>--%>
                            <%--<input type="radio" name="dutyMachine" value="2">--%>
                            <%--<span>自动考勤</span>--%>
                        <%--</label>--%>
                    </td>
                </tr>
                <tr>
                    <td style="display: flex; margin-left: 200px">
                        <div class="saveBtn">保存</div>
                        <div class="return"><a href="/attendanceWay/attindex">返回</a></div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $.ajax({
            type:'get',
            url:'/attendanceWay/settingMain',
            dataType:'json',
            success:function (res) {
                if(res.flag){
                    $(":radio[name='dutyMachine'][value='" + res.object + "']").prop("checked", "checked");
                }
            }
        })
    //    点击保存
        $('.saveBtn').click(function () {
            var radioVal=$("input[name='dutyMachine']:checked").val();
            $.ajax({
                type:'post',
                url:'/attendanceWay/settingUpdate',
                dataType:'json',
                data:{
                    dutyMachine:radioVal
                },
                success:function (res) {
                    if(res.flag){
                        layer.msg('保存成功！',{icon:6});
                        location.reload();
                    }else {
                        layer.msg('保存失败！',{icon:5});
                    }
                }
            })
        })
    })
</script>
</body>
</html>
